package main

import (
	"encoding/json"
	"fmt"
	"log"
)

func main() {

	type Movie struct {
		Title  string
		Year   int  `json:"released"`
		Color  bool `json:"color,omitempty"`
		Actors []string
	}

	var movies = []Movie{
		{Title: "Casablanca", Year: 1942, Color: false,
			Actors: []string{"Humphery Bogart", "Ingrid Bergman"}},
		{Title: "Citizen Kane", Year: 1941, Color: true,
			Actors: []string{"Orson Welles", "Joseph Cotten"}},
		{Title: "Double Indemnity", Year: 1944, Color: true,
			Actors: []string{"Edward Arnold", "Glenn Ford"}},
	}

	data, err := json.MarshalIndent(movies, "", " ")
	if err != nil {
		log.Fatalf("JSON marshaling failed: %s", err)
	}
	fmt.Printf("%s\n", data)

}
